Repository navigation
Examples: use the converters the API spec documents - #22
Merged
Merged
Conversation
The production API spec (https://v2.convertapi.com/info/openapi) has no web -> pdf and no jpg -> zip converter. examples/web now converts the URL with html -> pdf (same url and filename parameters), and examples/chaining zips the JPG results with file -> zip (same files parameter). Both files now end with a newline (gofmt). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 9, 2026
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the converter updates in the two Go examples.
No open issues 🎉
What changed in this PR
Updates two Go examples to use documented ConvertAPI converters while preserving their existing inputs and output settings.
Changes:
- Switches the web-to-PDF example from
web -> pdftohtml -> pdf. - Switches the chaining example’s ZIP step from
jpg -> ziptofile -> zip. - Adds final newlines to both files.
| File | Description |
|---|---|
examples/web/main.go |
Uses html -> pdf with the existing URL and filename. |
examples/chaining/main.go |
Uses file -> zip with the existing chained JPG results. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two examples call converters that the production API spec (https://v2.convertapi.com/info/openapi, 332 paths on 2026-11-09) does not list. Both still convert today, but developers copy these examples and the how-to guides on convertapi.com reuse them, so they should call documented converters. This is the Go part of what ConvertAPI/convertapi-library-dotnet#86 does for .NET.
examples/web/main.goweb -> pdfhtml -> pdf(parameters), sameurlandfilenameexamples/chaining/main.gojpg -> zipfile -> zip(parameters), samefilesparameterBoth files also get the final newline gofmt wants. The other Go examples already call documented converters (
docx -> pdf,docx -> jpg,pptx -> pdf,pdf -> split,pdf -> merge,html -> txt,pdf -> jpg).Verified against production (2026-11-09)
Go 1.27.3 in Docker (
golang:1.27):go vet ./...andgo build ./...pass, andgofmt -llists neither changed file. Each example ran withgo run ./examples/<name>from the repo root, once onmain(719594d) and once on this branch, with the token inAPI_TOKEN.examples/chaining, same output before and after:
Both runs saved a 711,617-byte
result.zipwithtest.jpgandtest-2.jpg; the JPGs are byte-identical before and after.examples/web, same output before and after:
The PDF text: on
main, and in the first run on this branch, Wikimedia answered ConvertAPI's renderer with its "Too many requests" page (1 page, 62 words). A second run on this branch got the article (3 pages, 1,925 words, title "Data conversion"). The rate limiting does not depend on the converter: in the same hour the samehtml -> pdfcall also rendered the article from the Python, PHP and Ruby examples, and the oldweb -> pdfcall got the error page from every SDK. The demo URL is being looked at separately.Seen, not changed: examples/chaining prints "Converting PDF to JPG" but converts
assets/test.docx.Same change in the other SDKs
🤖 Generated with Claude Code